package classpath

import (
	"io/ioutil"
	"path/filepath"
 )
type DirEntry struct{
	//存放目录的绝对路径
	absDir string
}

//构造函数
func newDirEntry(path string) *DirEntry{
	absDir,err := filepath.Abs(path);
	if err != nil {
		panic(err)
	}

	return &DirEntry{absDir:absDir};
}

//实现entry接口中的readClass方法
func (self *DirEntry) readClass(className string)([]byte,Entry,error){
	filename := filepath.Join(self.absDir,className)
	data,err := ioutil.ReadFile(filename)
	return data,self,err;
}
//实现entry接口中的String()方法
func (self *DirEntry) String() string{
	return self.absDir;
}

